package com.medusa.aps.business.model.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

/**
 * 数据来源枚举
 *
 * @author miskw
 * @date 2023/8/24
 * @describe 描述
 */
@Getter
public enum SourceEnum {
    /**
     * 数据导入
     */
    EXCEL(1, "数据导入"),
    /**
     * 手工录入
     */
    ARTIFICIAL(2, "手工录入");
    @EnumValue
    private final int value;
    private final String desc;

    SourceEnum(int value, String message) {
        this.value = value;
        this.desc = message;
    }

    public static String getDescByValue(int value) {
        for (SourceEnum sourceEnum : SourceEnum.values()) {
            if (sourceEnum.getValue() == value) {
                return sourceEnum.getDesc();
            }
        }
        return null;
    }

    public static SourceEnum getEnumByValue(int value) {
        for (SourceEnum sourceEnum : SourceEnum.values()) {
            if (sourceEnum.getValue() == value) {
                return sourceEnum;
            }
        }
        return null;
    }
}
